<?php
	include("./config.php");
	$tpl = new PhplibTpl($conf["admin_tpl_path"]);
	if (! empty($_GET['mode']) )
	{   
		include($conf["include_path"] . $_GET['mode'] . ".php");
	}
  

	//查询本站的管理员:rank_id<3
	$query = "SELECT * FROM $TBL_USERS WHERE user_type>0 AND user_type<2 ORDER BY user_id DESC";
  
	/* 处理模板 */
	$tpl -> set_file("main", "member.htm");  
	$tpl -> set_block("main", "MEM_LIST", "mem_list");  //会员显示块

	//实现分页 
	include( $conf['base_path'] . "lib/make_pages.php");
	$cur_page = (int)$_GET["p"];   //获取当前页
	$url_param = preg_replace("/(p=[0-9]+)&/", "", $_SERVER['QUERY_STRING']);
	$pages = new Pager($query, $cur_page, 20, $url_param);
	$page_string = $pages -> getPageString();   
	$res = $pages -> getRsPerPage();
	while ($rows = mysql_fetch_array($res))
	{
		$user_id = $rows["user_id"];
		$username = $rows["user_name"];  //用户名
		$user_email = $rows["user_email"];  //用户名
		$del_url="?mode=del_member&id=".$rows['user_id'];	
		$user_regdate = $rows["user_regdate"];  //注册日期
		$user_lastvisit = date("Y-m-j H:m:i", $rows["user_lastvisit"]);  //最后登录的时间
		$sin_name = $rows["user_realname"];  //真实姓名
		$tpl -> set_var(array(
							"USER_ID" => $user_id,
							"USERNAME" => $username,
							"DEL_URL" => $del_url,
							"last_visit" => $user_lastvisit,
							"USER_REGDATE" => $user_regdate,
							"REAL_NAME" => $sin_name,
							"user_email" => $user_email,
			
							));
		$tpl -> parse("mem_list", "MEM_LIST", true);
	}
	if (empty($page_string))
		$page_string = "此条件下暂时没有管理员";
	$tpl -> set_var(array(
						  "PAGE_STRING" => $page_string,
						  ));
	$tpl -> parse("Out_main", "main");
	$tpl -> p("Out_main");
?>